package com.guaju.yueshangclothing.viewmodel.login;

import android.content.Intent;
import android.databinding.BaseObservable;
import android.text.TextUtils;
import android.view.View;

import com.guaju.yueshangclothing.activity.SetupPasswordActivity;
import com.guaju.yueshangclothing.utils.NotifyUtil;
import com.guaju.yueshangclothing.utils.ToastUtil;

/**
 * Created by guaju on 2018/10/12.
 *
 */

public class FindPasswordVM extends BaseObservable {


    public String phoneNum;
    public String verifyCode;
    private Intent intent;


    public void nextStep(View v,String phoneNum, String verifyCode) {
        if (!NotifyUtil.isPhoneNum(phoneNum)) {
            ToastUtil.show("手机号格式不正确,请修改");
        } else if (TextUtils.isEmpty(verifyCode)||verifyCode.length()!=4) {
            ToastUtil.show("验证码错误,请检查");
        } else {
            //服务器校验
            setupPassword(v);
        }
    }

    public void nextStep(View v){
        nextStep(v,phoneNum,verifyCode);
    }



    public void setupPassword(View v){
        intent = new Intent(v.getContext(), SetupPasswordActivity.class);
        v.getContext().startActivity(intent);
    }
}
